package com.xx.pmis.web.util;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

/**
 * @class 当前日期和时间 <br>
 * 
 * @editor 石星星  @Date 2011-9-27 下午03:26:50 <br>
 * @version jdk_1.5.0
 */
public class CurrentDate {
    // 当前日期，格式如2011-09-27
	public static String currentDate() {
		SimpleDateFormat sdf = new SimpleDateFormat();
		sdf.applyPattern("yyyy-MM-dd");
		Date date = new Date();
		return sdf.format(date);
		
	}
	
    // 当前日期和时间，格式如2011-09-27
	public static String currentDateAndTime() {
		SimpleDateFormat sdf = new SimpleDateFormat();
		sdf.applyPattern("yyyy-MM-dd HH:mm:ss");
		Date date = new Date();
		return sdf.format(date);
		
	}
	
    // 当前日期，格式如2011-09-27 星期一
	public static String currentDateIncludeE() {
		SimpleDateFormat sdf = new SimpleDateFormat();
		sdf.applyPattern("yyyy-MM-dd E");
		Date date = new Date();
		return sdf.format(date);
		
	}
	
    // 当前日期，格式如2011
	public static String currentYear() {
		SimpleDateFormat sdf = new SimpleDateFormat();
		sdf.applyPattern("yyyy");
		Date date = new Date();
		return sdf.format(date);
		
	}
	
	
	@Test 
	public void testParseDouble() throws Exception {
		System.out.println("**************************" + CurrentDate.currentDate());
		System.out.println("\n**************************" + CurrentDate.currentDateAndTime());
		System.out.println("\n**************************" + CurrentDate.currentDateIncludeE());
		
	}

}
